package com.cyz.user.controller;

import com.cyz.common.dto.CommentDto;
import com.cyz.user.userService.CommentService;
import com.cyz.common.utils.R;
import com.cyz.common.validated.AddGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(tags = "用户端评论相关接口")
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @ApiOperation(value = "查询课程评论信息")
    @GetMapping("/queryCardComments")
    public R queryCardComments(Integer cardId){
        return commentService.queryCardComments(cardId);
    }

    @ApiOperation(value = "查询评论区评论")
    @GetMapping("/queryHelpComments")
    public R queryHelpComments(){
        return commentService.queryHelpComments();
    }

    @ApiOperation(value = "增加评论")
    @PostMapping("/addComment")
    public R addComment(@Validated(AddGroup.class) @RequestBody CommentDto commentDto){
        return commentService.addComment(commentDto);
    }

//    @ApiOperation(value = "删除评论信息")
//    @GetMapping("/deleteComment")
//    public R deleteComment(Integer id){
//        return commentService.deleteComment(id);
//    }

}
